package com.example.kyyl.http;

import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;
import rx.Observable;

/**
 * Created by on 2018/7/1.
 */

public interface ApiService {

    @GET()
    Observable<String> get(@Url String url, @QueryMap Map<String, String> params);

    @GET()
    Observable<String> get(@Url String url);

    @FormUrlEncoded
    @POST()
    Observable<String> post(@Url String url, @FieldMap Map<String, String> params);

    @POST()
    Observable<String> post(@Url String url);

    //    @Multipart
    //    @POST("upload")
    //    Call<ResponseBody> upload(@Part("description") RequestBody description,
    //                              @Part MultipartBody.Part file);

    @Multipart
    @POST()
    Observable<String> upload(@Url String url, @PartMap Map<String, String> params, @Part MultipartBody.Part file);

    @Streaming
    @GET()
    Call<ResponseBody> download(@Url String url);

}
